<?php

namespace App\Http\Controllers;

use App\Banner;
use App\Http\Resources\BannerCollection;
use App\Http\Resources\NotifyCollection;
use Illuminate\Http\Request;
use Illuminate\Notifications\DatabaseNotification;
use Illuminate\Support\Facades\DB;

class NotifyController extends Controller
{
    public function notify()
    {
        $userinfo = request()->user();
        $data = new NotifyCollection($userinfo->notifications()->paginate(6));
        return $data;
    }

//    public function notifydel()
//    {
//        DB::table('notifications')->where('id', request('id'))->del();
//        return response(['status' => 1, 'message' => '删除成功']);
//    }

    public function notifyread(DatabaseNotification $notification)
    {
        $notification->markAsRead();
        return response(['status' => 1, 'message' => '标致已读']);
    }
}
